<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/6/12
 * Time: 14:27
 */

namespace app\home\controller;


use app\common\controller\HomeBase;
use think\Db;

class Message extends HomeBase
{
    public function saveMessage()
    {
        if (request()->isPost())
        {
            $data   = [];
            $data['nickname']    = input('param.nickname');
            $data['mobile']      = input('param.mobile');
            $data['email']       = input('param.nickname');
            $data['description'] = input('param.description');
            $data['title']       = input('param.title');
            $data['content']     = input('param.content');
            $data['create_time'] = time();
            $data['content']     = time();
            $res                 = Db::name('message')->insertGetId($data);
            //ajax提交方式反回
            //return $res;
            if ($res)
            {
                $this->success('提交成功！');
            } else {
                $this->error('提交失败!');
            }
        }
    }
}